﻿
@{
    ViewBag.Title = "List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@using CSM_SQL;
@using System.Configuration;
@model List<ShowGoods>

<h1 style="float:right">
    @{string title = "";
        var type = Model.First().type;
        switch (type)
        {

            case 0:
                title = "零食&饮料";
                break;
            case 1: title = "电子&数码"; break;
            case 2: title = "厨卫&家居"; break;
            case 3: title = "水果&干果"; break;
            default: title = "其他"; break;
        }
    }
    @title
</h1>
<section class="grid-shop">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 col-md-12">



                <div class="grid-spr">
                    <div class="col-sm-6 col-md-6">
                        <a href=@Url.Action("Grid") class="grid-view-icon" style="background-color:rgb(245, 245, 245)"><i class="fa fa-th-large" style="color:black" aria-hidden="true"></i></a>
                        <a href=@Url.Action("List") class="list-view-icon" style="background-color:#B11E22"><i class="fa fa-th-list" style="color:white" aria-hidden="true"></i></a>

                    </div>
                    <div class="col-sm-6 col-md-6 text-right">  </div>


                @foreach (var m in Model)
                {
                    var path = ConfigurationManager.AppSettings["path"].ToString() + m.img;

                    <div class="col-xs-12 col-sm-12 col-md-12">
                        <!-- .pro-text -->
                        <div class="pro-text">
                            <div class="col-xs-12 col-sm-5 col-md-5">
                                <!-- .pro-img -->
                                <div class="pro-img">
                                    <img src=@path alt="2">
                                    @if (m.grade >= 5)
                                    {
                                        <sup class="sale-tag">sale!</sup>
                                    }
                                    <!-- .hover-icon -->
                                    <div class="hover-icon"> <a href="#"><span class="icon icon-Heart"></span>评分:@m.grade</a> </div>
                                    <!-- /.hover-icon -->
                                </div>
                                <!-- /.pro-img -->
                            </div>
                            <div class="col-xs-12 col-sm-7 col-md-7">
                                <div class="pro-text-outer list-pro-text">
                                    <h3>@m.name</h3>

                                    <div class="star2">

                                        <ul>
                                            @{var i = 0; }
                                            @for (i = 0; i < m.grade; i++)
                                            {
                                                <li class="yellow-color"><i class="fa fa-star" aria-hidden="true"></i></li>
                                            }

                                            @for (; i < 5; i++)
                                            {
                                                <li><i class="fa fa-star" aria-hidden="true"></i></li>
                                            }


                                        </ul>
                                    </div>
                                    <p>@m.detail</p>
                                    <p class="wk-price">￥@m.price </p>

                                    <a href="javascript:void(0)" onclick="pick(@m.id)" class="add-btn">加入购物车</a>
                                </div>
                            </div>
                        </div>
                        <!-- /.pro-text -->
                    </div>
                }


                <div class="col-xs-12">
                    <div class="grid-spr pag">
                        <!-- .pagetions -->
                        <div class="col-xs-12 col-sm-6 col-md-6 text-left">
                            <ul class="pagination">
                                @if (ViewBag.page > 1)
                                {
                                    <li><a href=@Url.Action("List",new { id = type,page = ViewBag.page - 1 })>&laquo;</a></li>
                                }
                                @for (int i = 1; i <= ViewBag.pages; i++)
                                {
                                    if (ViewBag.page == i)
                                    {
                                        <li class="active"><a href="javascript:void(0)">@i</a></li>
                                    }
                                    else
                                    {
                                        <li><a href=@Url.Action("List",new { id = type,page = i })>@i</a></li>
                                    }
                                }
                                @if (ViewBag.page < ViewBag.pages)
                                {
                                    <li><a href=@Url.Action("List",new { id = type,page = ViewBag.page + 1 })>&raquo;</a></li>
                                }



                            </ul>
                        </div>
                        <!-- /.pagetions -->
                        <!-- .Showing -->
                        <div class="col-xs-12 col-sm-6 col-md-6 text-right">
                            <strong></strong>
                        </div>
                        <!-- /.Showing -->
                    </div>
                </div>
            </div>
        </div>
    </div>

</section>